package com.yyjj.zixun.adapter;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yyjj.zixun.R;
import com.yyjj.zixun.activity.JingXuanDetailsActivity;
import com.yyjj.zixun.activity.ZJDActivity;
import com.yyjj.zixun.entity.JingXuanDetailsEntity;
import com.yyjj.zixun.entity.ZJDetailsEntity;

import java.util.ArrayList;

import tech.com.commoncore.utils.FastUtil;

/**
 * 专家详情
 */
public class ZJDAdapter extends BaseQuickAdapter<ZJDetailsEntity, BaseViewHolder> {

    public ZJDAdapter() {
        super(R.layout.zixun_item_netease, new ArrayList<ZJDetailsEntity>());
    }

    @Override
    protected void convert(BaseViewHolder helper, final ZJDetailsEntity item) {

        helper.setText(R.id.tv_time, item.getDate());
        helper.setText(R.id.tv_title, item.getTitle());

        ImageView view = helper.getView(R.id.img_news);
        Glide.with(mContext).load(item.getImages()).into(view);


        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle = new Bundle();
                bundle.putSerializable("title",item.getTitle()+"");
                bundle.putSerializable("url",item.getUrl()+"");
                FastUtil.startActivity(mContext,ZJDActivity.class,bundle);
            }
        });

    }
}
